package general.guicontrols.clusterpanels;

import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import general.art.Cluster;
import general.art.Node;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import viewdatabase.BasicGUI;

public class BasicDisplay extends JPanel {

	private final int mDepth;

	public BasicDisplay(Cluster c){

		mDepth = c.getDepth();
		this.setLayout( new FlowLayout());

		for(Node n : c.getNodes()){

			this.add(CreateButton(n));

		}

	}

	/**
	 * 
	 * @param n
	 * @return
	 */
	private JButton CreateButton(final Node n){

		JButton tempB  = new JButton(n.getName());
		tempB.addMouseListener( new MouseAdapter(){

			@Override
			public void mouseClicked(MouseEvent arg0) {
				BasicGUI.createInterFace(n.getKey(), mDepth);

			}



		});

		return tempB;

	}


}
